﻿#region itdc

/************************************************************************
*Copyright(C) 2015 by qsgy
 *All rights reserved. 
 *FileName:     $safeitemname$
 *Author:       oyh
 *Version:      
 *UnityVersion：
 *Date:   $time$      
 *Description:    
 *History: 
************************************************************************/
#endregion
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 触发激活器。
/// 只有特定的物体接触时才激活目标。离开时间则关闭激活
/// </summary>
public class Tiper : Activator  
{
    public bool enableOnExit = false;
    #region mono method

    private void OnTriggerEnter(Collider other)
    {
       //print(Matching(other));
        if (!Matching(other)) return;
        SetAct(true);

    }
    private void OnTriggerExit(Collider other)
    {
        if (!enableOnExit) return;
        if (!Matching(other)) return;
        SetAct(false);
    }

    #endregion
    #region normal method
    //过滤方法。满足条件则 激活/关闭
    public virtual bool Matching(Collider other)
    {
        if (other.tag == GameManager.PLAYER) return true;
        return false;
    }

   
    #endregion
}
